/**
 * 公用model模板
 * 需求参数 formAry form数组结构格式如下
 * [
   {
     id: 1,
     labelText: '左侧提示文字',
     type:'数据输入形式 input  select ',
     isMust: '表单提交时是否验证必填',
     errMessage:"如果验证必填 的错误提示",
     placeHolder:'输入前提示'
     selectAry:[{//如果是select 则该项必填
       id: 2,
       name: "选项名称"
     }]
   }
 ]
 */
<template>
  <a-modal
    :title="模板"
    :width="800"
    :visible="true"
    :confirmLoading="false"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-form :form="form" @submit="handleSubmit">
      <a-form-item v-for="(item,index) in formAry" :key="item.id" :labelCol="labelCol" :wrapperCol="wrapperCol" :label='item.labelText'>
        <a-input v-if="item.type == 'input'" :placeholder="item.placeHolder" v-decorator="['groupType', { rules: [{ required: item.isMust,message: item.errMessage }]}]" />
        <a-select v-if="item.type == 'select'" :placeholder="item.placeHolder" v-decorator="['groupType', { rules: [{ required: item.isMust,message: item.errMessage }]}]">
          <a-select-option
            v-for="(letter,indexS) in item.selectAry"
            :key="indexS"
            :value="`${letter.id}`"
          >{{letter.name}}</a-select-option>
        </a-select>
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script>
export default {
  name: 'ModelUnsual',
  props:['formAry'],
  data() {
    return {
      
    }
  },
  created() {
    // alert(JSON.stringify(this.formAry));
  },
  methods: {}
}
</script>

<style lang="less" scoped>
</style>